/**
 * Copyright (C), 2015-2018, XXX有限公司
 * FileName: DictController
 * Author:   zhouheng
 * Date:     2018/7/19 11:13
 * Description: 字典控制类
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.hengby.hengcrud.modular.sys.controller;

import com.hengby.hengcrud.core.common.annotation.Permission;
import com.hengby.hengcrud.core.constants.Const;
import com.hengby.hengcrud.modular.base.controller.BaseController;
import com.hengby.hengcrud.modular.sys.service.IDictService;
import com.hengby.hengcrud.modular.sys.warpper.DictWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * 〈一句话功能简述〉<br> 
 * 〈字典控制类〉
 *
 * @author zhouheng
 * @create 2018/7/19
 * @since 1.0.0
 */
@Controller
@RequestMapping("/dict")
public class DictController extends BaseController{

    private static final String PREFIX_= "/system/dict/";

    @Autowired
    IDictService dictService;

    @RequestMapping("")
    public String dict(){



        return PREFIX_+ "dict";
    }

    @RequestMapping("list")
    @ResponseBody
    @Permission(value = Const.ADMIN_NAME)
    public Object list(@RequestParam(value = "condition",required = false) String condition){
        List<Map<String, Object>> list = this.dictService.list(condition);
        return super.warpObject(new DictWrapper(list));
    }
}